﻿<Window x:Class="Listas.Lists"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Lista" Height="700" Width="1000" SizeChanged="Window_SizeChanged" Background="Black" 
        ResizeMode ="CanMinimize" MinHeight="700" MinWidth="1000">
    
    <Window.Resources>

        <ResourceDictionary>
            
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/CommomFunctions;component/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <Style TargetType="{x:Type Button}">
                <Setter Property = "MinWidth" Value="50" />
                <Setter Property = "MinHeight" Value="25" />
                <Setter Property = "IsEnabled" Value="False" />
                <Setter Property = "Grid.Row" Value="4" />
                <Setter Property = "Grid.RowSpan" Value="2" />
                <Setter Property = "Grid.ColumnSpan" Value="2" />
                <Setter Property = "VerticalAlignment" Value="Top" />
                <Setter Property = "HorizontalAlignment" Value="Stretch" />
            </Style>
            
            <Style TargetType="{x:Type Border}">
                <Setter Property = "BorderThickness" Value="2" />
                <Setter Property = "BorderBrush" Value="YellowGreen" />
                <Setter Property = "Grid.ColumnSpan" Value="2" />
            </Style>
            
            <Style TargetType="{x:Type Label}">
                <Setter Property = "Foreground" Value="Gold" />
                <Setter Property = "FontWeight" Value="Bold" />
                <Setter Property = "FontSize" Value="20" />
                <Setter Property = "VerticalAlignment" Value="Top" />                
            </Style>
            
        </ResourceDictionary>        

    </Window.Resources>
    
    <Grid Name="Gridi" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ShowGridLines="False" Margin="0" ClipToBounds="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="60*" />
            <RowDefinition Height="50*" />
            <RowDefinition Height="50*" />
            <RowDefinition Height="50*" />
            <RowDefinition Height="50*" />
            <RowDefinition Height="50*" />
        </Grid.RowDefinitions>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
        </Grid.ColumnDefinitions>
                                  
        <Button Name="btnInsertFirst" Click="btnInsertFirst_Click" Margin="91,84,60,0" Grid.Column="0">Início</Button>
        <Button Name="btnInsertLast" Click="btnInsertLast_Click" Margin="91,126,60,0" Grid.Column="0">Fim</Button>
        <Button Name="btnInsertAt" Click="btnInsertAt_Click" Margin="91,168,60,0" Grid.Column="0">Em K</Button>
        <Button Name="btnRemoveFirst" Click="btnRemoveFirst_Click" Margin="19,84,130,0" Grid.Column="2">Primeiro</Button>
        <Button Name="btnRemoveLast" Click="btnRemoveLast_Click" Margin="19,126,130,0" Grid.Column="2">Último</Button>
        <Button Name="btnRemoveAt" Click="btnRemoveAt_Click" Margin="19,168,130,0" Grid.Column="2">K-ésimo</Button>
        <Button Name="btnCreate"  Grid.Row="3"  Margin="115,45,25,145" Click="btnCria_Click" IsEnabled="True">Criar Lista</Button>
        <Button Name="btnDestroy"  Grid.Row="3"  Margin="115,85,25,105" Click="btnDestroi_Click" >Destruir Lista</Button>
        
        <Border Name="insertBorder" Margin="75,135,15,10" Grid.Column="0" Grid.Row="3" Grid.RowSpan="3"></Border>
        <Border Name="removeBorder" Margin="0,135,80,10" Grid.Column="2" Grid.Row="3" Grid.RowSpan="3"></Border>
        <Border Name="freeMemoryBorder" Margin="15,5,15,75" Grid.Column="7" Grid.Row="0" Grid.RowSpan="2"></Border>
                
        <Label Name="lblInsert" Grid.Column="0" Grid.ColumnSpan="1" Grid.Row="4" Grid.RowSpan="2"
               Margin="50,30,-50,10" HorizontalAlignment="Right" VerticalContentAlignment ="Top">Insere</Label>
        <Label Name="lblRemove" Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="4" Grid.RowSpan="2"
               Margin="20,30,40,0" HorizontalAlignment="Left" VerticalContentAlignment ="Top">Remove</Label>
        <Label Name="lblMemoLivre" Grid.Row="0" Grid.Column="7" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" 
               VerticalContentAlignment="Center" HorizontalContentAlignment="Center">Memória</Label>
        
        <Menu Grid.Row="0" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Left" >
        
            <MenuItem Header="_Ajuda">
                <MenuItem Name="help" Click="help_Click" Header="Ajuda Estrutura de Dados"/>
                <MenuItem Name="tutorial" Click="tutorial_Click" Header="Tutorial"/>
                <MenuItem Name="about" Click="about_Click" Header="Sobre"/>
            </MenuItem>

        </Menu>
        
        <RichTextBox Name="txtCode" Margin="95,35,0,10" Grid.Column="5" Grid.ColumnSpan="4" Grid.Row="2" Grid.RowSpan="4" Height="330" VerticalAlignment="Bottom" Width="330" MaxWidth="350"
                 AcceptsTab="False" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Left" IsReadOnly="True" Background="Black" BorderBrush ="YellowGreen"
                 Focusable ="False" IsHitTestVisible="False">

            <FlowDocument>
                <Paragraph FontFamily="comic sans" Foreground="AntiqueWhite" FontSize="19">Operações Básicas com Listas em C#</Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Cria nova lista
                    <LineBreak/>
                    <Run Foreground="SkyBlue">ArrayList</Run>
                    <Run Foreground="LightGray">minhaLista =</Run>
                    <Run Foreground="Blue">new</Run>
                    <Run Foreground="SkyBlue">ArrayList</Run>
                    <Run Foreground="LightGray">( );</Run>
                </Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Insere o elemento no fim da lista
                    <LineBreak/>
                    <Run Foreground="LightGray">minhaLista.Add( elemento );</Run>
                </Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Remove a primeira ocorrência do elemento
                    <LineBreak/>
                    <Run Foreground="LightGray">minhaLista.Remove( elemento );</Run>
                </Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Insere o elemento na posição indicada
                    <LineBreak/>
                    <Run Foreground="LightGray">minhaLista.Insert( posição, elemento );</Run>
                </Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Remove o conteúdo da posição indicada
                    <LineBreak/>
                    <Run Foreground="LightGray">minhaLista.RemoveAt( posição );</Run>
                </Paragraph>
            </FlowDocument>
        </RichTextBox>
        
    </Grid>
</Window>

